package com.boruan.qq.zxgylibrary.utils;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

import com.convenient.qd.core.utils.NetworkUtils;

/**
 * Created by 崔琦 on 2019/4/13.
 * des: ....
 */

public class NetWorkUtil {

    public static boolean isOnline(Context context) {
//        ConnectivityManager cm =
//                (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
//        NetworkInfo netInfo = cm.getActiveNetworkInfo();
//        if (netInfo == null) {
//            return false;
//        } else {
//            return netInfo.isConnectedOrConnecting();
//        }

        if ("1".equals(NetworkUtils.getNetType(context)[0]) || "2".equals(NetworkUtils.getNetType(context)[0])) {
            return true;
        }
        return false;
    }
}
